<?php

/**
 * @package		Joomla.Site
 * @subpackage	mod_wrapper
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
// no direct access
defined('_JEXEC') or die;

class modPSupportHelper {

  static function checkYahooStatus(&$yahooAccount) {
//echo $params;
    $yahoo = file_get_contents('http://opi.yahoo.com/online?u=' . $yahooAccount . '&m=t');
    $check = 'NOT';
    $pos = strpos($yahoo, $check);
    $statusYahoo = ($pos == FALSE) ? 'yahoo_online' : 'yahoo_offline';
    return $statusYahoo;
  }

  static function checkSkypeStatus(&$skypeAccount) {
    $skype = file_get_contents('http://mystatus.skype.com/' . $skypeAccount . '.xml');
    $xml = simplexml_load_string($skype);
    $json = json_encode($xml);
    $array = json_decode($json, TRUE);
    foreach ($array as $status) {
      $statusCode = $status['statusCode'];
      $statusImg = ($statusCode != 1) ? 'skype_online' : 'skype_offline';
      return $statusImg;
    }
  }

}